<template>
	<view class="content">
		<image :class="className" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title" @click="open">{{title}}</text>
		</view>
		<view>
			<view>{{ number = 1 }}</view>
			<view>{{ ok ? 'YES':'NO' }}</view>
			<view>{{ message.split('').reverse().join('') }}</view>
		</view>
		<!--传递静态参数-->
		<button @click="handleClick('参数1')"> 按钮1 </button>
		<!--传递动态参数（来自data）-->
		<button @click="handleClick(dynamicParam)"> 按钮2 </button>
		<!--传递多个参数 + 事件对象-->
		<button @click="handleClick('参数A','参数B',$event)"> 按钮3 </button>
		<view class="modelclass">
			<input v-model="message" placeholder="edit me"/>
			<text>Message is:{{ message }}</text>
		</view>
		<view v-if="!raining ">今天天气真好</view>
		<view v-if="raining">下雨天，只能在家呆着了</view>
		<view v-if="state === 'vue'">state的值是 Vue</view>
		<view>State is {{ state?'vue':'APP' }}</view>
		<view v-for="item in arr" style="color: #ff0000;">
			{{ item }}
		</view>
		<view v-for="(item,index) in 4" style="color: #00ff00;">
			<view :class="'list-' + index%2">{{ index%2 }}</view>
		</view>
		<view v-for="(value,name,index) in object">
			{{ index }}.{{ name }}:{{ value }}
		</view>
		<view v-for="item in arr":key ="item.id">
			<view style="color: #0000ff;">{{ item.id }}:{{ item.name }}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:'Hello UniAPP',
				number: 1,
				ok:true,
				message:'Hello Vue !',
				className:"smalllogo",
				dynamicParam:"我是动态参数",
				message:"",
				raining:false,
				state:'vue',
				arr:[
					{id:1,name:'uni-app'},
					{id:2,name:'HTML'}
				],
				object:{
					title:'How to do lists in Vue',
					author:'Jone Doe',
					publisheAt:'2025-10-14'
				}
			}
		},
		methods: {
			open(){
				this.title="opening a new Page";
				this.className='logo'
			},
			//接收参数
			handleClick(param1,param2,event){
				console.log("参数1:",param1)
				console.log("参数2:",param1)
				console.log("事件对象:",event)
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	
	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}
	.smalllogo{
		height: 50rpx;
		width: 50rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}
	.text-area {
		display: flex;
		justify-content: center;
	}
	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	.modelclass{
		height: 100rpx;
		width: 100%;
		background-color: aquamarine;
	}
</style>
